package io.bloom.webspider;

import lombok.Data;

import java.util.List;
import java.util.Map;

@Data
public class SpiderResponse
{
    private SpiderRequest request;

    private String charset;
    private int status;

    private String rawText;
    private byte[] rawBinary;

    private Map<String, List<String>> headers;

    private Map<String,Object> data;

    private List<String> links;

    public boolean isOk()
    {
        return 200 == status;
    }

    public boolean isFail()
    {
        return 505 == status;
    }

    public static SpiderResponse OK=new SpiderResponse(){
        {
            setStatus(200);
        }
    };

    public static SpiderResponse FAIL=new SpiderResponse(){
        {
            setStatus(505);
        }
    };

}
